package gui.win.barcode;

import gui.Segl1;
import gui.utils.Borders;
import gui.utils.FilePicker;
import gui.utils.Para;
import gui.utils.Slider;
import gui.utils.SliderWrap;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;

/*Author: John Archer, Contact: john.archer.jpa@gmail.com*/
public class BarCodes extends JFrame{
    private FilePicker openingReads, openingBarcodes;

    public BarCodes(Segl1 Seg_L1){
        super();
        this.setLocation(Seg_L1.getLocationOnScreen().x + 50, Seg_L1.getLocationOnScreen().y + 50);
        this.setLayout(new FlowLayout());
        this.setSize(new Dimension(400, 230));

        JPanel p0 = new JPanel();
        p0.setBorder(Borders.getTitledBorder(Borders.STANDARD_TITLED_BORDER, "BARCODE SORTING"));
        p0.setLayout(new BorderLayout());

        JPanel p1 = new JPanel();
        p1.setLayout(new BorderLayout());
        p1.add(openingReads = new FilePicker("DATA (FASTQ)",true, 21,134), BorderLayout.NORTH);
        p1.add(openingBarcodes = new FilePicker("BARCODES",true, 21, 134), BorderLayout.SOUTH);
        p0.add(p1, BorderLayout.NORTH);

        JPanel p2 = new JPanel();
        p2.setLayout(new BorderLayout());
        p2.add(new SliderWrap(Slider.TOLERATE, 5, 0, Para.TOLERATE , "MISMATCHES TOLERATED", 170, 3), BorderLayout.NORTH);
        p2.add(new SliderWrap(Slider.BUFF, 40, 0, Para.BUFF , "CLIP FROM START", 170, 3), BorderLayout.CENTER);
        p0.add(p2, BorderLayout.CENTER);

        
        this.add(p0, BorderLayout.CENTER);
        this.add(new Buttons(this, Seg_L1), BorderLayout.SOUTH);
        this.setVisible(true);
        this.setAlwaysOnTop(true);
    }

    public void closeFrame(){this.dispose();}
    public String getPathToReads(){return openingReads.getPath();}
    public String getPathToBarcodes(){return openingBarcodes.getPath();}
}
